<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>用户管理</title>
	<jsp:include page="../../import.jsp" flush="true" />
</head>

<body class="iframeBody">
<div class="Wrapper">
	<div class="searchArea">
		<form id="searchBar">
			<div class="fieldset1 clearFix">
				<div class="fieldBox">
					<div class="label">事业部</div>
					<div class="field">
						<input name="buOrgCd" id="buOrgCd" placeholder="请选择" ltype="combobox">
					</div>
				</div>

				<div class="clearFix"></div>
				<div class="btnsBox">
					<span id="searchBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_1"></i>查询</span>
				</div>
			</div>
		</form>
	</div>
	<div id="pageInTab" class="pageInTab">
		<div tabid="tabA" title="敞口统计" lselected="true">

			<div id="ligergrid1" class="sq-grid">





			</div>


		</div>

	</div>
</div>

<script type="text/javascript">
    var pageInApp={
        flag:true
    }; // to 下一级子窗口 接口
    var pageInTab=null;
    var loadedTabs=[]
    var grid = null,
        Editable=true;
    var prjId = '${prjId}';
    var buOrgCd = '${buOrgCd}';
    var useCache = '${useCache}';
    $(function () {
        initTab();
        grid =  $("#ligergrid1").ligerGrid({
            url: '<%=path%>/exposure/capPrjArInfo/initTable.do?prjId='+prjId,
            method : 'get',
			parms:{
            	"buOrgCd":buOrgCd,
				"useCache":useCache
			},
            columns: [
                { display: '主体类型', name: 'mainTypNm',enabledSort:false },
                { display: '主体ID', name: 'id',hide:true,enabledSort:true},
                { display: '主体名称', name: 'mainNm',enabledSort:true},
                { display: '融资/担保情况', name: 'rzDb', enabledSort:true },
                { display: '车辆类型', name: 'carType' ,  enabledSort:true},
				{ display: '历史30+逾期次数（--）',enabledSort:true,name: 'ovd30CountB',width:150	},
				{ display: '历史30+逾期次数(合计)', name: 'ovd30Count' ,  enabledSort:true,width:150},
                { display: '当前逾期的支付表数（--）', enabledSort:true,name: 'ovdCountB',width:170},
				{ display: '当前逾期的支付表数(合计)', name: 'ovdCount' ,  enabledSort:true,width:170},
                { display: 'A：已发起评审流程且未通过的支付表敞口(--)',name: 'prjAudAmtB',render: function (rowdata, rowindex, value) {
						return FormatMoney(rowdata.prjAudAmtB/100);
					},width:270},
				{ display: 'A：已发起评审流程且未通过的支付表敞口(合计)', name: 'prjAudAmt' ,  enabledSort:true,render: function (rowdata, rowindex, value) {
						return FormatMoney(rowdata.prjAudAmt/100);
					},width:270},
				{ display: 'B：评审通过未放款的支付表敞口(--)',name: 'payAmtB',render: function (rowdata, rowindex, value) {
						return FormatMoney(rowdata.payAmtB/100);
					},width:240},
				{ display: 'B：评审通过未放款的支付表敞口(合计)',name: 'payAmt',render: function (rowdata, rowindex, value) {
						return FormatMoney(rowdata.payAmt/100);
					},width:240},
				{ display: 'C：已放款支付表剩余敞口(--)',name: 'paidAmtB',render: function (rowdata, rowindex, value) {
						return FormatMoney(rowdata.paidAmtB/100);
					},width:200},
				{ display: 'C：已放款支付表剩余敞口(合计)',name: 'paidAmt',render: function (rowdata, rowindex, value) {
						return FormatMoney(rowdata.paidAmt/100);
					},width:200},
				{ display: '敞口合计：A+B+C(--)',name: 'sumB',render: function (rowdata, rowindex, value) {
						return FormatMoney(rowdata.sumB/100);
					},width:160},
				{ display: '敞口合计：A+B+C(合计)',name: 'sum',render: function (rowdata, rowindex, value) {
						return FormatMoney(rowdata.sum/100);
					},width:160},
            ],
            pageSize:100,
            pageSizeOptions: [100],
            root:'rows',
            record:'total',
            hideLoadButton : true,
            width: '100%',
            isScroll: true,
			frozen:false,
            checkbox:true,
            rownumbers:true,
            onAfterShowData: function () {
                $('#ligergrid1').rowspan('mainTypNm');
                $('#ligergrid1').rowspan('mainNm');
                $('#ligergrid1').rowspan('rzOrDb');
                $('#ligergrid1').rowspan('carType');
            }
        });
		changeTableHead(buOrgCd);

		//事业部
		$("#buOrgCd").ligerComboBox({
			valueField: 'key',
			textField: 'value'
		});
		var isShowCondition = "${isShowCondition}";
		if(!("1"===isShowCondition)){
			$("#searchBar").hide();
		}
		var buOrgCdList = ${buOrgCdList};
        $("#pageloading").hide();
        liger.get("buOrgCd").setData(buOrgCdList);

		$("#searchBar").ligerForm();
		$("#searchBtn").click(function(event) {
			var form = new liger.get("searchBar");
			var data = form.getData();
			var buOrgCd = data.buOrgCd;
			changeTableHead(buOrgCd);
			for (name in data){
				grid.setParm(name,data[name]);
			};
			grid.reload();
		});

    });

    function changeTableHead(buOrgCd){
		var buOrgCdList = ${buOrgCdList};
		if(StringUtils.isNotEmpty(buOrgCd)){
			for (var x of buOrgCdList) {
				if(buOrgCd == x.key){
					grid.changeHeaderText("ovd30CountB","历史30+逾期次数（"+x.value.replace("事业部","")+")");
					grid.changeHeaderText("ovdCountB","当前逾期的支付表数("+x.value.replace("事业部","")+")");
					grid.changeHeaderText("prjAudAmtB","A：已发起评审流程且未通过的支付表敞口("+x.value.replace("事业部","") + ")");
					grid.changeHeaderText("payAmtB","B：评审通过未放款的支付表敞口("+x.value.replace("事业部","") + ")");
					grid.changeHeaderText("paidAmtB","C：已放款支付表剩余敞口("+x.value.replace("事业部","") + ")");
					grid.changeHeaderText("sumB","敞口合计：A+B+C("+x.value.replace("事业部","") + ")");
				}
			}
		}
	}
    //初始化Tab
    function initTab(){
        pageInTab = $("#pageInTab").ligerTab({
            height: 'auto',
            contextmenu: false,
            minIframeHeight: GET_minIframeHeight(),
            onBeforeSelectTabItem: function (tabid) {
                if(tabid!="tabA"){

                }
            },
            onAfterSelectTabItem: function(tabid) {
                if (loadedTabs.indexOf(tabid)<0) {
                    loadedTabs.push(tabid);
                    switch (tabid){
                        case "tabB":
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/system/sysUsr/toSplUsrListPage.do");
                            break;
                    }
                };
                SetIframe_height();
            }
        });

        $.extend(true, pageInApp, {
            pageInTab: pageInTab
        });
    };





    function iframeResize_pageIn () {
        if (parent.pageInApp) {
            parent.pageInApp.pageInTab.onResize();
            iframeResize ()
        };
    }
    function iframeResize () {
        if (parent.parent.mainApp) {
            parent.parent.mainApp.parentTab.onResize();
        };
    }




</script>
</body>
</html>
